<style lang="less">
.gonggaoDetail{
	.van-cell-group {
		.van-cell {
			display: -webkit-box;
			font-size: 14px;
			.van-cell__title {
				text-align-last: left;
				color: #141A20;
			}
			.van-cell__value {
				top: 16px;
				color: #BABBBD;
				font-size: 10px;
				position: static;
			}
			.text_right {
				float: right;
				color: #9B9EA0;
			}
		}
		.text {
			font-size: 10px;
			color: #909192;
		}
		.login_out {
			color: #FF2F2F;
		}
	}
}
</style>
<template>
	<mxq-router-layout>
		<div class="gonggaoDetail">
			<Head slot="header" @headerClick="headerClick($event)">
				<div slot="headerTitle">
					公告详情
				</div>
				<div slot="headerRight">
					<i class="iconfont icon-shouye"/>
					<!-- <van-icon class="home" name="home"/> -->
				</div>
			</Head>
			<van-cell-group>
				<van-cell 
					v-for="(item,index) in xqArr" :key="index">
					<template slot="title">
						<span class="van-cell-text">{{ item.title }}</span>
						<span class="van-cell-text text_right">{{ item.label }}</span>
					</template>
					<!--<template slot="title" v-if="item.type == 'content'">
						<span class="van-cell-text">{{ item.title }}</span>
						<span class="van-cell-text text_right">{{ item.label }}</span>
					</template>-->
				</van-cell>
			</van-cell-group>
		</div>
	</mxq-router-layout>
</template>

<script>
import Head from '@/components/head';
import { callData } from '../../axios/axios';
import {
	Icon,
	Cell,
    CellGroup,
    Notify
} from 'vant';

export default {
    name: 'news',
    components: {
		Head,
		[Icon.name]: Icon,
		[Cell.name]: Cell,
        [CellGroup.name]: CellGroup
	},
	data() {
		return {
			getQuery: this.$route.query,
			xqArr: []
		}
	},
	methods: {
		headerClick() {
			this.$router.push({name:"index"})
		},
		getXiangqing() {
			let _this = this,
				query = this.getQuery,
				param = {};
				param.id = query.id
			callData('/statisServer/notice/appNoticeByUserId', 'get', param).then(res => {
				if(res.success) this.getXqShow(res.data[0])
			}, err => {
				
			})
		},
		getXqShow(item){
			let DW = item.DEPT_NAME;
			let dow = item.NOTICE_TYPE,
				LX = dow == '1'?"系统消息":dow == '2'?"惩罚":dow == '3'?"即时消息":dow == '4'?"奖励":"";
			this.xqArr=[
				{title: "公告标题",label: item.TITLE},
				{title: "公告类型",label: LX},
				{title: "发布人",label: item.REALNAME},
				{title: "发布单位",label: DW},
				{title: "发布时间",label: item.CREATE_TIME},
				{title: "公告内容",label: item.CONTENT,type:"content"}
			]
		},
		redearNow(){
			let param = {},
				query = this.getQuery;
				param.id = query.id
			callData('/statisServer/notice/updateIsRead', 'put', param).then(res => {
				
			}, err => {
				
			})
		}
	},
	mounted() {
		this.getXiangqing()
		this.redearNow()
	}
}
</script>